﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

// Reviewed
#pragma once

#include "GcmpModelInterface.h"
#include "RegenDataId.h"
#include "IDbObject.h"

namespace gcmp
{
    class IDocument;
    class IGraphicsElementShape;
    class ElementId;
    class IElement;

    /// \brief 打洞关系行为，管理对象间的打洞关系
    FINAL_INTERFACE class GCMP_MODEL_INTERFACE_EXPORT IOpeningRelationshipBehavior : public IDbObject
    {
        DEFINE_CAST_DERIVED(gcmp::IOpeningRelationshipBehavior, gcmp::IDbObject);
    public:
        /// \brief 析构函数
        virtual ~IOpeningRelationshipBehavior() {};

        /// \brief 创建打洞关系行为
        /// \param pDocument 当前文档
        /// \param ownerElementId 宿主对象的ElementId
        /// \return 打洞关系行为
        static OwnerPtr<IOpeningRelationshipBehavior> Create(IDocument* pDocument, const ElementId& ownerElementId);

        /// \brief 获取所有ElementOpening的ElementId
        /// \return 所有ElementOpening的ElementId
        virtual const std::vector<ElementId>& GetElementOpeningIds() const = 0;

        /// \brief 添加ElementOpening
        /// \param ElementOpening的ElementId
        /// \return 成功返回true，失败返回false
        virtual bool AddElementOpeningId(const ElementId& elementId)  = 0;

        /// \brief 移除ElementOpening
        /// \param ElementOpening的ElementId
        /// \return 成功返回true，失败返回false
        virtual bool DeleteElementOpeningId(const ElementId& elementId)  = 0;

        /// \brief 移除ElementOpening
        /// \param ElementOpening的ElementIds
        /// \return 成功返回true，失败返回false
        virtual bool DeleteElementOpeningIds(const std::vector<ElementId>& elementIds) = 0;

        /// \brief 设置该行为所属Element
        /// \param pOwnerElement 所属Element
        /// \return bool
        virtual bool SetOwnerElement(IElement* pOwnerElement) = 0;

        /// \brief 获得该外部对象所属Element
        /// \return const IElement* 所属Element
        virtual const IElement* GetOwnerElement() const = 0;

        /// \brief 获得该外部对象所属Element
        /// \return IElement* 所属Element
        virtual IElement* GetOwnerElement() = 0;

        /// \brief 获取所有开洞关系对象ElementId的关联更新id（打洞关系对象的增、删）
        /// \return 获取开洞关系ElementId数组的RegenDataId
        virtual RegenDataId GetElementOpeningIdsRdId() const = 0;

        /// \brief 获取所有会影响打洞对象的关联更新id（打洞关系对象数据的变化）
        /// \return 获取所有影响会打洞对象的RegenDataId
        virtual std::vector<RegenDataId> GetElementOpeningRdIds() const = 0;

        /// \brief 获取所有会影响被打洞对象的关联更新id（被打洞关系对象数据的变化）
        /// \return 获取所有会影响被打洞对象的RegenDataId
        virtual std::vector<RegenDataId> GetElementOpenedRdIds() const = 0;
    };
}


